<template>
  <div class="cart">
    <mynavbar></mynavbar>
    <!-- 商品卡片 -->
    <div class="box">
      <van-card
        :num="v.num"
        :price="v.originprice"
        :desc="v.brand"
        :title="v.proname"
        :thumb="v.img1"
        ref="dom"
        v-for="(v, index) in list"
        :key="index"
      >
      </van-card>
    </div>
    <!-- 金额总价 -->
    <van-submit-bar :price="totio" button-text="提交订单" @submit="onSubmit" />
  </div>
</template>

<script>
import mynavbar from "../../yjj/item/mynavbar.vue";
import service from "../../../request/service";
export default {
  data() {
    return {
      goodsinfo: "",
      number: 1,
      show: "false",
      pri: 0,
      list: [],
      totio: 0,
    };
  },
  methods: {
    onSubmit() {},

    fun3() {
      service({
        url: `http://118.178.238.19:3001/api/cart/list`,
        method: "post",
        data: {
          token: sessionStorage.getItem("token"),
          userid: sessionStorage.getItem("userid"),
        },
      }).then((res) => {
        this.list = res.data.data;
        res.data.data.forEach((item) => {
          this.totio += item.originprice * 100 * item.num;
        });
      });
    },
  },
  created() {
    this.fun3();
    // console.log(this.goodsinfo.originprice);
    // if (this.goodsinfo.originprice == 'undefined') {
    //     // this.pri =0
    // }
  },
  components: {
    mynavbar,
  },
};
</script>

<style scoped>
.van-card__footer .van-button {
  width: 1.875rem;
}

van-card__price {
  color: #ed3833;
}
</style>